package me.tuyou.function;

import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.aggregation.Aggregations;
import org.apache.flink.api.java.operators.AggregateOperator;
import org.apache.flink.api.java.operators.DataSource;
import org.apache.flink.api.java.operators.DistinctOperator;
import org.apache.flink.api.java.operators.UnsortedGrouping;
import org.apache.flink.api.java.tuple.Tuple2;

public class DistinctTest {

    public static void main(String[] args) throws Exception {
        ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
        DataSource<Tuple2<Integer, Integer>> dataSource = env.fromElements(Tuple2.of(1,1),
                Tuple2.of(1,1),
                Tuple2.of(2,2),
                Tuple2.of(2,2),
                Tuple2.of(3,3),
                Tuple2.of(3,3)
        );
        System.out.println("数据源：");
        dataSource.print();
        DistinctOperator<Tuple2<Integer, Integer>> distinct = dataSource.distinct();
        System.out.println("结果：");
        distinct.print();
    }
}
